// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()
const db = cloud.database()
const _ = db.command
// 云函数入口函数
exports.main = async (event, context) => {
  let date = event.date
  let dateObj = new Date(date)

  // 查询数据库，返回用户的所有日程
  return db.collection('schedule').where(_.or([
    {
      type:'schedule',
      date: '2023-02-14',
      openId: 'oCNw-4_fGIWwntcOKq3AHyG6fn4s'
    },
    {
      type:'schedule',
      circulation:'daily',
      openId: 'oCNw-4_fGIWwntcOKq3AHyG6fn4s'
    },
    {
      type:'schedule',
      circulation:'weekly',
      openId: 'oCNw-4_fGIWwntcOKq3AHyG6fn4s'
    }
  ])).get()
  .then(res=>{
    return res
  })
}